package b3.widget.home.town
{
	import b3.config.*;
	import b3.model.*;
	import b3.net.*;
	import b3.util.*;
	import b3.widget.basic.*;
	
	import com.greensock.*;
	
	import flash.display.*;
	import flash.filters.*;
	import flash.text.*;

	public class CenterInfoPane extends BasicWidget
	{
		public function CenterInfoPane()
		{
			super();
			this.anchor = ANCHOR_MIDDLE_TOP;
			this.x = -20;
			this.y = 60;
		}
		
		public function showInfo(infoSprite:Sprite):void
		{
			clear();
			var container:Sprite = new Sprite();
			container.addChild(infoSprite);
			container.x = -container.width / 2;
			addChild(container);
			TweenLite.from(container, 0.5, {alpha: 0}); 
		}
		
		public function showOperationTip(iconImage:String, tip:String, tipColor:uint):void
		{
			var container:Sprite = new Sprite();
			//图标
			var GoldCoinIcon:Class = ResourceHelper.getInstance().getClassByName(iconImage);
			var goldCoinIcon:Sprite = new GoldCoinIcon();
			goldCoinIcon.height = 60;
			goldCoinIcon.scaleX = goldCoinIcon.scaleY;
			goldCoinIcon.x = 10;
			goldCoinIcon.y = 0;
			container.addChild(goldCoinIcon);
			//金币
			var me:Player = PlayerManager.getInstance().me;
			var goldCoinText:TextField = new TextField();
			goldCoinText.selectable = false;
			goldCoinText.autoSize = TextFieldAutoSize.LEFT;
			goldCoinText.defaultTextFormat = new TextFormat("微软雅黑", 25, 0xFFFFFF, true);
			goldCoinText.filters = [new GlowFilter(tipColor, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			goldCoinText.text = tip;
			goldCoinText.x = goldCoinIcon.x + goldCoinIcon.width + 10;
			goldCoinText.y = 12;
			container.addChild(goldCoinText);
			showInfo(container);
		} 
		
		public function clear():void
		{
			while (numChildren > 0)
				removeChildAt(0);
		}
		
	}
}